/// <reference path="../Bootstrap/js/bootstrap.min.js" />
/// <reference path="../Knockout/knockout-3.3.0.js" />
/// <reference path="mars.validation.js" />
/// <reference path="jquery-1.11.2.min.js" />
/// <reference path="mars.masterlists.js" />
/// <reference path="../JQueryValidation/jquery.validate.min.js" />

var MARS_CONSTANTS = {
    USER_ROLES: {
        ADMIN: "Admin",
        MODEL_SUBMITTER: "Model Submitter",
        MODEL_OWNER: "Model Owner",
        IVG: "IVG",
        IVG_HEAD: "IVG Head",
        STREAM_LEAD: "Stream Lead",
        MRO_CRO: "MRO\CRO",
        BUE: "BUE",
    },
    MODEL_STATUS: {
        NEW: "New",
        DRAFT: "Draft",
        NOT_SUBMITTED: "Not Submitted",
        MODEL_SUBMITTED: "Model Submitted",
        LOG_KEY_FINDINGS: "Log Key Findings",
        MODEL_RISK_SCORE: "Model Risk Score",
        MODEL_VALIDATED: "Model Validated",
        COULD_NOT_BE_VALIDATED: "Could not be Validated",
        CLOSED_WITHDRWAN: "Closed - Withdrawn",
        CANCELLED: "Cancelled",
    },
    VALIDATION_STATUS: {
        NEW: "New",
        DRAFT: "Draft",
        NOT_SUBMITTED: "Not Submitted",
        MODEL_SUBMITTED: "Model Submitted",
        LOG_KEY_FINDINGS: "Log Key Findings",
        MODEL_RISK_SCORE: "Model Risk Score",
        MODEL_VALIDATED: "Model Validated",
        COULD_NOT_BE_VALIDATED: "Could not be Validated",
        CLOSED_WITHDRWAN: "Closed - Withdrawn",
        CANCELLED: "Cancelled",
    },
    FOLDER_NAMES: {
        DEVELOPMENT_DOCUMENTS: "Development Documents",
        IMPLEMENTATION_DOCUMENTS: "Implementation Documents",
        INDEPENDENT_VALIDATION_DOCUMENTS: "Independent Validation Documents",
        ANCILLARY_DOCUMENTS: "Ancillary Documents",
        DATA_SET: "Data Set",
        EXECUTIVE_SUMMARY: "Executive Summary",
        RISK_DOCUMENTS: "Risk Documents",
    },
    COLUMN_NAMES: {
        MODEL_ID: "ModelId",
        VALIDATION_ID: "ValidationId",
        MODEL_NAME: "ModelName",
        MODEL_SUBMITTER_FULL_NAME: "ModelSubmitter",
        MODEL_SUBMITTER_USER_NAME: "ModelSubmitterUserName",
        MODEL_SUBMITTER_EMAIL: "ModelSubmitterUserName",
    },
    MARS_LIST_NAMES: {
        MARS_MAIN: "MARS",
        MARS_DOCUMENTS: "MARS_DOCUMENTS",
        MARS_USER_ROLES: "MARS_USER_ROLES"
    },    
    IGNORE_MAPPING_MODEL_SUMMARY: {
        'ignore': ["DevelopmentSourceList", "BusinessUnitList", "IVGHeadList", "ModelOwnerList", "BusinessUnitExecutiveList",
                  "StreamLeadList", "MROList", "RiskAcceptanceCommitteeNameList",
                  "CheckedTier1UseCases", "CheckedTier2UseCases", "CheckedTier3UseCases", "CheckedTier4UseCases",
                  "Tier1UseCasesList", "Tier2UseCasesList", "Tier3UseCasesList", "Tier4UseCasesList", "IsNewModel", "JSObject"]

    },
    IGNORE_MAPPING_VALIDATION_HOME: {
        'ignore': ["DevelopmentDocuments", "ImplementationDocuments", "IndependentValidationDocuments", "ExecutiveSummaryDocuments",
                   "DataSetDocuments", "AncillaryDocuments",
                   "LeadValidatorList", "ValidationTrackerList", "Phase1ProgressList", "Phase2ProgressList", "Phase3ProgressList",
                   "Phase4ProgressList", "Phase5ProgressList", "Phase6ProgressList", "JSObject"]
    },
    IGNORE_MAPPING_CHAT_HISTORY_MODEL: {
        'ignore': ["ChatMessage", "ChatUserUserName", "ChatUserFullName", "ChatDateTime",
                   "ChatMessageList", "ChatUserUserNameList", "ChatUserFullNameList", "ChatDateTimeList",
                   "ChatHistory", "EnableAddMessageButton", "JSObject"]
    },
    IGNORE_MAPPING_CHECKOUT_MODEL: {
        'ignore': ["IsModelCheckedOut", "IsModelCheckedOutToMe", "JSObject"]
    },
    IGNORE_MAPPING_MODEL_RISK_SCORE: {
        'ignore': ["CurrentUserName", "RiskFile", "JSObject"]
    },
    IGNORE_MAPPING_KEY_FINDINGS: {
        'ignore': ["FindingNumber", "FindingType", "FindingDescription", "ActionPlan", "TargetDate", "CompletionDate",
            "FindingNumbersList", "FindingTypesList", "FindingDescriptionsList", "ActionPlansList", "TargetDatesList", "CompletionDatesList",
            "JSObject", "FindingTypeList", "KeyFindings", "EnableSaveChangesButton"]
    },
    IGNORE_MAPPING_ACKNOWLEDGEMENT_DOCUMENT: {
        'ignore': ["JSObject"]
    },    
    
    STRING_SEPERATOR: "*$#",

    RECORD_SEPERATOR: "**$$##"
};

var MRS_QUESTION = function (questionLabel, riskAttribute, description, selectionValue) {
    this.QuestionLabel = questionLabel;
    this.RiskAttribute = riskAttribute;
    this.Description = description;
    this.SelectionValue = selectionValue;
}

var MRS_QUESTIONAIRE = {
    IMQ_A_QUESTIONAIRE: [
        new MRS_QUESTION("A", "Amount of Data", "Data used to build model is too sparse or there is not enough history to support reliable estimation", 0),
        new MRS_QUESTION("A", "Age of Data", "Data used to build model is too old for the model purpose", 0),
        new MRS_QUESTION("A", "Data Accuracy", "Data (either input data or data used to build the model) is not accurate and/or irrelevant data is used. The data uses approximations and proxies that materially impact quality", 0),
        new MRS_QUESTION("A", "Cross Model Risk", "Model results depend critically on inputs from other models", 0),
        new MRS_QUESTION("A", "Completeness", "Data (either input data or data used to build the model) is missing important fields", 0),
    ],
    IMQ_B_QUESTIONAIRE: [
        new MRS_QUESTION("B", "Theory", "There are multiple plausible specifications that could be used by this model, and the results are sensitive to the particular specification selected", 0),
        new MRS_QUESTION("B", "Variable Selection", "It is not clear what variables or factors should be included in the model", 0),
        new MRS_QUESTION("B", "Assumptions", "Model uses many judgmental assumptions and output is highly sensitive to these", 0),
        new MRS_QUESTION("B", "Model Fitting", "Model results are heavily skewed by data outliers", 0),
    ],
    IMQ_C_QUESTIONAIRE: [
        new MRS_QUESTION("C", "Complexity", "Model uses complex software, configurations, or coding", 0),
        new MRS_QUESTION("C", "Vendor Software", "Model requires specialized vendor software that is not widely used or accepted in the industry", 0),
        new MRS_QUESTION("C", "Testing", "User Acceptance Testing has material defects. For example, it may utilize inadequate test data and incorrect versions of software", 0),
    ],
    IMQ_D_QUESTIONAIRE: [
        new MRS_QUESTION("D", "Low Predictability", "Model has a low level of predictive power (e.g., model explains only a small percentage of possible variation in the dependent variable) or is predicting a very rare 'tail' event", 0),
        new MRS_QUESTION("D", "Long Term Predictions", "Model must make a long term prediction (say, more than 5 years out) based on historical experience", 0),
    ],
    RMI_E_QUESTIONAIRE: [
        new MRS_QUESTION("E", "Data Control", "Quality of input data is well controlled (i.e., there are clear controls in place to ensure data is as accurate, relevant, and complete as possible.)", 0),
        new MRS_QUESTION("E", "Data Documentation", "Data inputs are clearly reported in the validation documents", 0),
    ],
    RMI_F_QUESTIONAIRE: [
        new MRS_QUESTION("F", "Documentation Quality", "Rationale for theory and specification of model is well documented and justified", 0),
        new MRS_QUESTION("F", "Back testing", "Back testing procedures, if any, are appropriate", 0),
        new MRS_QUESTION("F", "Judgmental Assumptions", "The judgmental assumptions used in the model are reasonable and supported by logic", 0),
        new MRS_QUESTION("F", "Benchmarking", "Benchmarking, if any, is adequate and is consistent with the industry's best practice", 0),
    ],
    RMI_G_QUESTIONAIRE: [
        new MRS_QUESTION("G", "User Training", "Model user is well trained", 0),
        new MRS_QUESTION("G", "Model Security", "Model is secure and cannot be altered easily", 0),
        new MRS_QUESTION("G", "Checks and Balances", "Code is sufficiently validated", 0),
        new MRS_QUESTION("G", "Ownership and Accountability", "Model owner is clearly defined and has full accountability", 0),
    ],
    RMI_H_QUESTIONAIRE: [
        new MRS_QUESTION("H", "Review", "Model has been sufficiently reviewed by the business", 0),
        new MRS_QUESTION("H", "Appropriate Use", "The particular application and usage of the model results is appropriate and within the scope of the model's intent", 0),
        new MRS_QUESTION("H", "Feedback Loop", "Model has an effective feedback process that allows users to make timely corrections to the model", 0),
    ],
};



